<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of BWeEventController
 *
 * @author I062261
 */
class WeEventController extends Controller {

    //put your code here
    public function actionListEvent() {
        if (yii::app()->request->isAjaxRequest) {
            //$updateControl = Blyn::app()->getUIManager()->getUpdateControl();
            //$updateControl->addRenderView('eventList');
        }
    }

    public function actionAddEvent() {
        if (yii::app()->request->isAjaxRequest) {
            $updateControl = Blyn::app()->getUIManager()->getUpdateControl();
            $senderControl = Blyn::app()->getUIManager()->getSenderControl();
            //$screen = Blyn::app()->getUIManager()->getCurrentScreen();
            //          $updateControl->addRenderView('addNewEvent');

            if ($senderControl->isAjaxLinkClicked('保存')) {
                if (!empty($_POST)) {
                    
                    $eventName = $_POST['name0'];

                    $event = new BWEvent();
                    $event->name = $eventName;
                    $event->title = $eventName . ' title';

                    $event->save();
                }
            }
        }
    }

    public function actionManageEvent() {
        
    }

    public function actionDeleteEvent() {
        
    }

}

?>
